fix: API Docs link breaks under ingress prefix without trailing slash#3
fix: API Docs link breaks under ingress prefix without trailing slash#3
Conversation
…ixes The raw href="docs" resolved against window.location, which drops the last path segment when the page URL has no trailing slash. Visiting https://www.ebi.ac.uk/pride/services/sdrf-validator pointed the docs link at /pride/services/docs instead of /pride/services/sdrf-validator/docs. Reuse the existing apiUrl() helper (which guarantees a trailing-slash base) to set the href at runtime.
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 16 minutes and 36 seconds.Comment |
Summary
When deployed at
https://www.ebi.ac.uk/pride/services/sdrf-validator(no trailing slash), the API Docs link in the page footer points to/pride/services/docsinstead of/pride/services/sdrf-validator/docs.Root cause
static/index.htmlhad a relative anchor:The browser resolves
href="docs"againstwindow.location. With no trailing slash, the last path segment (sdrf-validator) is treated as a "file" and dropped, sodocsresolves against the parent directory.The page already has a
computeApiBase()helper that normalises the path with a trailing slash for fetch calls — this PR reuses it to set the docs link at runtime.Change
id="api-docs-link"to the anchor.baseUrlis computed, setdocsLink.href = apiUrl('docs')so the link is always an absolute URL anchored at the (trailing-slash-normalised) base.Works in all three deployment shapes:
http://localhost:8000/http://localhost:8000/docshttps://www.ebi.ac.uk/pride/services/sdrf-validator/…/sdrf-validator/docshttps://www.ebi.ac.uk/pride/services/sdrf-validator(was broken)…/sdrf-validator/docs✓Test plan
/, click API Docs → lands on/docs.ROOT_PATH=/pride/services/sdrf-validator, visit the URL without trailing slash, click API Docs → lands on/pride/services/sdrf-validator/docs./templates,/validate) still resolve correctly (unchanged code path, regression check).https://claude.ai/code/session_01YDvKh2KVn8BpyMB1gk4yFo
Generated by Claude Code